import apiClient from './index';

const addressService = {
  // 获取用户所有收货地址
  getAddresses: () => {
    return apiClient.get('/users/profile/addresses');
  },

  // 添加新收货地址
  addAddress: (addressData) => {
    return apiClient.post('/users/profile/addresses', addressData);
  },

  // 修改收货地址
  updateAddress: (addressId, addressData) => {
    return apiClient.put(`/users/profile/addresses/${addressId}`, addressData);
  },

  // 删除收货地址
  deleteAddress: (addressId) => {
    return apiClient.delete(`/users/profile/addresses/${addressId}`);
  },

  // 设置默认收货地址
  setDefaultAddress: (addressId) => {
    return apiClient.patch(`/users/profile/addresses/${addressId}/set-default`);
  },
};

export default addressService; 